import pandas as pd
import numpy as np
import matplotlib.pyplot as plt
import seaborn as sns
%matplotlib inline

out_file        = "scan_after_theo_80_c.dat"


file_names = []#存文件名
file_names.append("../output/2_hbhs_output_80_2.dat")  #继续添加文件名

df_dat = []
for file_name in file_names:
    df_tmp = pd.read_csv(file_name, delim_whitespace=True,  skiprows=0, nrows=1000000)
    #df_tmp = pd.read_csv(file_name, delim_whitespace=True,  skiprows=1000000, nrows=1000000)
    #df_tmp = pd.read_csv(file_name, delim_whitespace=True,  skiprows=2000000, nrows=1000000)
    df_dat.append(df_tmp)

df_sim=pd.read_csv(file_name, delim_whitespace=True, nrows=2)
df  = pd.concat(df_dat)
df.columns=df_sim.columns
print("文件一共有 ",len(df), " 行数据。")
print("数据共有 ", len(df.columns)," 列， 列名为：")
for i in df.columns:
    print(i,end=' ')

data_theo = df[(df["stability"]==1.0) & (df["unitarity"]==1.0) & (df["perturb"]==1.0)].copy()
print("原有 ",len(df)," 条数据， 经过理论限制后，还剩余 ",len(data_theo),"条数据。")
data_theo.to_csv(out_file,sep=' ',header=True, encoding='utf_8_sig', index=False)
